﻿@model PaymentHelper.Methods.NganLuong.Models.CompletedPaymentModel
@{
    ViewBag.Title = ViewBag.Resources["NganLuong.FinishPayment"];   

}
<div class="ph_payment_container">
    @if (string.IsNullOrEmpty(Model.ErrorText))
    {
        <p>
            @ViewBag.Resources["NganLuong.Success"]
        </p>
        <table>
            <tr>
                <td class="lable">@ViewBag.Resources["NganLuong.PaymentId"]
                </td>
                <td class="value">@Model.PaymerId
                </td>
            </tr>
            <tr>
                <td class="lable">@ViewBag.Resources["NganLuong.OrderCode"]
                </td>
                <td class="value">@Model.OrderCode
                </td>
            </tr>
            <tr>
                <td class="lable">@ViewBag.Resources["NganLuong.PaymentType"]
                </td>
                <td class="value">
                    @if (Model.PaymentType == 1)
                    {
                        @ViewBag.Resources["NganLuong.ImmediatePayment"]
                    }
                    else
                    {
                        @ViewBag.Resources["NganLuong.HoldPayment"]
                    }
                </td>
            </tr>
            <tr>
                <td class="lable">@ViewBag.Resources["NganLuong.Price"]
                </td>
                <td class="value">@Model.Price
                </td>
            </tr>
        </table>
    }
    else
    {
        <p>
            @ViewBag.Resources["NganLuong.Failed"]
        </p>
        <p style="border: 1px solid #ddd;">
            @Model.ErrorText
        </p>
    }
    <div id="ph_redirectToProcessResult">
        <p>
            @ViewBag.Resources["NganLuong.WaitingMessage"] <span id="ph_redirectToProcessResultTime"
                style="font-weight: bold;">10</span> s.
        </p>
        <p>
            <a href="@ViewBag.ProcessResultUrl" id="ph_linkToProcess">@ViewBag.Resources["NganLuong.NavigateNow"]</a>
        </p>
    </div>
</div>
<script type="text/javascript">

    window.onload = countDown();

    function countDown() {
        var time = $('#ph_redirectToProcessResultTime').html();

        if (time <= 0) {
            location.href = $('#ph_linkToProcess').attr("href");
        } else {
            time = time - 1;
            $('#ph_redirectToProcessResultTime').html(time);
            setTimeout("countDown()", 1000);
        }
    }
</script>
